<!doctype html>
<html>
    <head>
        <meta charset="UTF-8"/>
        <title>品牌管理</title>
	    <link rel="stylesheet" type="text/css" href="/webapp/css/easyui.css">
	    <link rel="stylesheet" type="text/css" href="/webapp/css/icon.css">
        <link rel="stylesheet" type="text/css" href="/webapp/css/color.css">
        <link rel="stylesheet" type="text/css" href="/webapp/css/public.css">
	    <script type="text/javascript" src="/webapp/js/lib/jquery.min.js"></script>
	    <script type="text/javascript" src="/webapp/js/lib/jquery.easyui.min.js"></script>
        <script type="text/javascript" src="/webapp/js/lib/jquery.global.settings.js"></script>
	    <script type="text/javascript" src="/webapp/js/lib/ajaxfileupload.js"></script>
	    <script type="text/javascript" src="/webapp/js/common/config.js"></script>
    </head>
    <body>
       <div class="easyui-container-fluid">
          <div class="easyui-panel" style="border: none;">
            <div class="nav" id="nav"></div> 
            <div class="easyui-panel" style="border:none;">
               <form id="ff">
                <div style="margin-bottom:20px;">
                  <label class="item-label">代码：</label>
                  <input type="text" name="code"  class="easyui-textbox" style="width:100px;"/>
                  <label class="item-label">名称：</label>
                  <input type="text" name="name"  class="easyui-textbox" style="width:100px;"/>
                  <!--<label class="item-label">英文名称：</label>
                  <input class="easyui-textbox" style="width:100px;" type="text" name="englishName"  />-->
                  <label class="item-label">客户品牌</label>
                  <select name="custom" class="easyui-combobox" style="width:100px;" data-options="panelHeight:'auto'">
                    <option value="">-请选择-</option>
                    <option value="true">是</option>
                    <option value="false">否</option>
                  </select>
                    <label class="item-label">国内品牌：</label>
                    <select name="international" class="easyui-combobox" style="width:100px;" data-options="panelHeight:'auto'">
                        <option value="">-请选择-</option>
                        <option value="DOMESTIC">内</option>
                        <option value="FOREIGN">外</option>
                    </select>
                    <label class="item-label">互联网：</label>
                    <select name="internet" class="easyui-combobox" style="width:100px;" data-options="panelHeight:'auto'">
                        <option value="">-请选择-</option>
                        <option value="true">是</option>
                        <option value="false">否</option>
                    </select>
                    <label class="item-label">状态：</label>
                    <input id="entityStatus" class="easyui-switchbutton" checked style="width:80px;height:30px;" onText="启用" offText="禁用"  >
                    <a class="easyui-linkbutton c8" style="width:80px;margin-left: 40px;" href="javascript:void(0);" onclick="searchBy()">查询</a>
                </div>
              </form>
            </div>
            <div class="table-wrapper">
             <table id="datagrid" data-options="fitColumns:true,scrollbarSize:0">
               <thead>
                 <tr>
                   <th data-options="field:'code',align:'center'" width="100">代码</th>
                   <th data-options="field:'name',align:'center'" width="100" formatter="nameFormat">名称</th>
                   <th data-options="field:'originalName',align:'center'" width="80" formatter="nameFormat">曾用名</th>
                   <th data-options="field:'prettyPinyin',align:'center'" width="100" formatter="nameFormat">拼音</th>
                   <th data-options="field:'englishName',align:'center'" width="160">英文名称</th>
                   <th data-options="field:'originalEnglishName',align:'center'" width="100" formatter="nameFormat">曾用英文名</th>
                   <th data-options="field:'alias',align:'center'" width="240">别名</th>
                   <th data-options="field:'international',align:'center'" width="100" formatter="internationalFormat">国内品牌</th>
                   <th data-options="field:'internet',align:'center',formatter:boolFormatter" width="100">互联网品牌</th>
                   <th data-options="field:'updateTime',align:'center'" width="140">操作时间</th>
                   <th data-options="field:'operateUser',align:'center'" width="80">操作人</th>
                   <th data-options="field:'entityStatus',align:'center',formatter:statusFormatter" width="100">状态</th>
                   <th data-options="field:'action',formatter:actions,align:'center'" width="180">操作</th>
                 </tr>
               </thead>
               <tbody>
               </tbody>
             </table>
           </div>
          </div> 
       </div>  
    </body>
    <script type="text/javascript">
           $(function(){
               var data = window.parent.userCategoryManageList;
               var height = $(window).height();
               var nav_height = $("#nav")._outerHeight();
               var ff_height = $("#ff").height();
               var table_height = height-nav_height-ff_height-40;
               $("#datagrid").css("max-height",table_height);
               $("#datagrid").datagrid({
                   toolbar:[{
                        text:"添加品牌",
                        handler:function(){
                          	window.parent.addTab("添加品牌","/webapp/pages/product/brand/add.html");
                        }
                      }]
               });
               aRecords("品牌管理","/webapp/pages/product/brand/")
           });
           function internationalFormat(val, row) {
           		if('DOMESTIC'==val){
           			return '国内';
           		}
           		if('FOREIGN'==val){
           			return '国外';
           		}
            	return '--';
           }
           function nameFormat(val, row) {
           		if(row.parentBrandName){
           			return val + '(' + row.parentBrandName + ')';
           		}else{
           			return val;
           		}
           }
           $("#ff").keydown(function (event) {
               var e = event || window.event;
               var keyCode = e.keyCode || e.which;
               if(keyCode=="13"){
                   searchBy();
               }
           });
      </script>
      <script type="text/javascript" src="/webapp/js/common/pagelist.js"></script>

      <script type="text/javascript">
          function actions(val, row){
              var disableBtnText = row.entityStatus=='OK'?'禁用':"启用";
              var roles=window.parent.roles;
              if(roles){
                  if(roles[0].name=="产品分析员" ||roles[0].name=="渠道管理员"){
                      return "<a href='javascript:void(0);' class='easyui-linkbutton l-btn l-btn-small' "+
                          "style='width:60px;' onclick='edit(\""+row.id+"\",\""+row.categoryCode+"\")'>修改</a>&nbsp;&nbsp;</a>";
                  }
              }
              return "<a href='javascript:void(0);' class='easyui-linkbutton l-btn l-btn-small' "+
                  "style='width:60px;' onclick='edit(\""+row.id+"\",\""+row.categoryCode+"\")'>修改</a>&nbsp;&nbsp;"+
                  "<a href='javascript:void(0);' class='easyui-linkbutton l-btn l-btn-small' style='width:60px;' onclick='updateStatus(\""+row.id+"\", \"" + row.entityStatus +"\", \""
                  + row.code +"\", \"" + row.brandCode +"\", \"" + row.categoryCode + "\")'>"+disableBtnText+"</a>";
          }
          function edit(id,categoryCode){
              window.parent.addTab("修改品牌", "/webapp/pages/product/brand/add.html?id="+id);
          }
      </script>
</html>
